package com.mine.stream;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * TODO
 *
 * @author wangtonggui
 * @version 1.0.0
 * @since 2021/09/26 15:46
 */
public class StreamDemo {
  @Test
  public void list2Map() {
    List<String> list = new ArrayList<>();
    list.add("1");
    list.add("2");
    list.add("3");
    list.add("4");
    System.out.println(list.stream().collect(Collectors.toMap(s -> s, s -> s)));
  }
}
